//
//  UIControlEnums.swift
//  Documentation
//
//  Created by Toj on 7/28/23.
//

import Foundation

extension UIControl {

    public struct Event : OptionSet {

        public init(rawValue: UInt)

        // 单点触摸按下事件, 点触屏幕
        public static var touchDown: UIControl.Event { get }

        // 多点触摸按下事件, 点触计数大于1. 按下第2、3或第4根手指的时候
        public static var touchDownRepeat: UIControl.Event { get }

        // 触摸在控件内拖动时
        public static var touchDragInside: UIControl.Event { get }

        // 触摸在控件外拖动时
        public static var touchDragOutside: UIControl.Event { get }

        // 触摸从控件之外拖动到内部时
        public static var touchDragEnter: UIControl.Event { get }

        // 触摸从控件内部拖动到外部时
        public static var touchDragExit: UIControl.Event { get }

        // 在控件之内触摸并抬起事件
        public static var touchUpInside: UIControl.Event { get }

        // 在控件之外触摸抬起事件
        public static var touchUpOutside: UIControl.Event { get }

        // 触摸取消事件, 即一次触摸因为放上太多手指而被取消, 或者电话打断
        public static var touchCancel: UIControl.Event { get }

        // 值修改: UISwitch点击修改isOn
        public static var valueChanged: UIControl.Event { get }

        @available(iOS 9.0, *)
        public static var primaryActionTriggered: UIControl.Event { get }

        @available(iOS 14.0, *)
        public static var menuActionTriggered: UIControl.Event { get }

        
        public static var editingDidBegin: UIControl.Event { get }

        // UITextField编辑中
        public static var editingChanged: UIControl.Event { get }

        public static var editingDidEnd: UIControl.Event { get }

        public static var editingDidEndOnExit: UIControl.Event { get }

        
        public static var allTouchEvents: UIControl.Event { get }

        public static var allEditingEvents: UIControl.Event { get }

        public static var applicationReserved: UIControl.Event { get }

        public static var systemReserved: UIControl.Event { get }

        public static var allEvents: UIControl.Event { get }
    }

    
    public enum ContentVerticalAlignment : Int {

        
        case center = 0

        case top = 1

        case bottom = 2

        case fill = 3
    }

    
    public enum ContentHorizontalAlignment : Int {

        
        case center = 0

        case left = 1

        case right = 2

        case fill = 3

        @available(iOS 11.0, *)
        case leading = 4

        @available(iOS 11.0, *)
        case trailing = 5
    }

    
    public struct State : OptionSet {

        public init(rawValue: UInt)

        
        public static var normal: UIControl.State { get }

        public static var highlighted: UIControl.State { get } // used when UIControl isHighlighted is set
        
        public static var disabled: UIControl.State { get }

        public static var selected: UIControl.State { get } // flag usable by app (see below)

        @available(iOS 9.0, *)
        public static var focused: UIControl.State { get } // Applicable only when the screen supports focus

        public static var application: UIControl.State { get } // additional flags available for application use

        public static var reserved: UIControl.State { get } // flags reserved for internal framework use
    }
}
